"""
堆结构 - Top-K问题
"""
import heapq
# from collections import namedtuple

# matrix = [[0] * 10 for _ in range(10)]
# for row in matrix:
#     print(row)


# class Card:

#     def __init__(self, suite, face):
#         self.suite = suite
#         self.face = face


# Card = namedtuple('Card', ('suite', 'face'))
# print(Card, Card.__name__)


# class Poker:

#     def __init__(self):
#         self.cards = [Card(suite, face) 
#                       for suite in '黑红梅方'
#                       for face in range(1, 14)]


# poker = Poker()
# for suite, face in poker.cards:
#     print(f'{suite}{face}')

nums = [55, 32, 18, 40, 68, 95, 72, 20]
print(heapq.nlargest(3, nums))
print(heapq.nsmallest(3, nums))
